.class public Lcom/xiaomi/notes/DragView;
.super Ljava/lang/Object;
.source "DragView.java"


# instance fields
.field private context:Landroid/content/Context;

.field private lpWindowManager:Landroid/view/WindowManager$LayoutParams;

.field private map:Ljava/util/Map;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/Map",
            "<",
            "Ljava/lang/String;",
            "Ljava/lang/Object;",
            ">;"
        }
    .end annotation
.end field

.field private nH:I

.field private nId:J

.field private nW:I

.field private nX:I

.field private nY:I

.field private objWindowsManager:Landroid/view/WindowManager;

.field private viewRoot:Landroid/view/View;


# direct methods
.method public constructor <init>(Landroid/content/Context;)V
    .locals 2
    .parameter "context"

    .prologue
    const/4 v0, 0x0

    .line 37
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 27
    iput-object v0, p0, Lcom/xiaomi/notes/DragView;->context:Landroid/content/Context;

    .line 29
    iput-object v0, p0, Lcom/xiaomi/notes/DragView;->objWindowsManager:Landroid/view/WindowManager;

    .line 31
    iput-object v0, p0, Lcom/xiaomi/notes/DragView;->lpWindowManager:Landroid/view/WindowManager$LayoutParams;

    .line 33
    iput-object v0, p0, Lcom/xiaomi/notes/DragView;->viewRoot:Landroid/view/View;

    .line 38
    iput-object p1, p0, Lcom/xiaomi/notes/DragView;->context:Landroid/content/Context;

    .line 39
    iget-object v0, p0, Lcom/xiaomi/notes/DragView;->context:Landroid/content/Context;

    const-string v1, "window"

    invoke-virtual {v0, v1}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/view/WindowManager;

    iput-object v0, p0, Lcom/xiaomi/notes/DragView;->objWindowsManager:Landroid/view/WindowManager;

    .line 40
    return-void
.end method

.method private initView()V
    .locals 9

    .prologue
    const/16 v8, 0x8

    .line 86
    iget-object v6, p0, Lcom/xiaomi/notes/DragView;->viewRoot:Landroid/view/View;

    const v7, 0x7f070026

    invoke-virtual {v6, v7}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v3

    check-cast v3, Landroid/widget/LinearLayout;

    .line 88
    .local v3, layout:Landroid/widget/LinearLayout;
    iget-object v6, p0, Lcom/xiaomi/notes/DragView;->viewRoot:Landroid/view/View;

    const v7, 0x7f070028

    invoke-virtual {v6, v7}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v5

    check-cast v5, Landroid/widget/TextView;

    .line 89
    .local v5, txtTitle:Landroid/widget/TextView;
    iget-object v6, p0, Lcom/xiaomi/notes/DragView;->viewRoot:Landroid/view/View;

    const v7, 0x7f070029

    invoke-virtual {v6, v7}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v4

    check-cast v4, Landroid/widget/TextView;

    .line 90
    .local v4, txtTime:Landroid/widget/TextView;
    iget-object v6, p0, Lcom/xiaomi/notes/DragView;->viewRoot:Landroid/view/View;

    const v7, 0x7f070027

    invoke-virtual {v6, v7}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v2

    check-cast v2, Landroid/widget/ImageView;

    .line 91
    .local v2, imgAlert:Landroid/widget/ImageView;
    iget-object v6, p0, Lcom/xiaomi/notes/DragView;->viewRoot:Landroid/view/View;

    const v7, 0x7f07002a

    invoke-virtual {v6, v7}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v0

    check-cast v0, Landroid/widget/CheckBox;

    .line 94
    .local v0, chkDelete:Landroid/widget/CheckBox;
    iget-object v6, p0, Lcom/xiaomi/notes/DragView;->map:Ljava/util/Map;

    const-string v7, "bgcolorId"

    invoke-interface {v6, v7}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v6

    check-cast v6, Ljava/lang/Integer;

    invoke-virtual {v6}, Ljava/lang/Integer;->intValue()I

    move-result v6

    packed-switch v6, :pswitch_data_0

    .line 113
    :goto_0
    iget-object v6, p0, Lcom/xiaomi/notes/DragView;->map:Ljava/util/Map;

    const-string v7, "content"

    invoke-interface {v6, v7}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Ljava/lang/String;

    .line 114
    .local v1, content:Ljava/lang/String;
    const/16 v6, 0x1e

    invoke-static {v1, v6}, Lcom/xiaomi/notes/Tools;->getTitleString(Ljava/lang/CharSequence;I)Ljava/lang/CharSequence;

    move-result-object v6

    invoke-virtual {v5, v6}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V

    .line 116
    const/4 v6, 0x4

    invoke-virtual {v4, v6}, Landroid/widget/TextView;->setVisibility(I)V

    .line 117
    invoke-virtual {v2, v8}, Landroid/widget/ImageView;->setVisibility(I)V

    .line 118
    invoke-virtual {v0, v8}, Landroid/widget/CheckBox;->setVisibility(I)V

    .line 119
    return-void

    .line 96
    .end local v1           #content:Ljava/lang/String;
    :pswitch_0
    const v6, 0x7f020026

    invoke-virtual {v3, v6}, Landroid/widget/LinearLayout;->setBackgroundResource(I)V

    goto :goto_0

    .line 99
    :pswitch_1
    const v6, 0x7f020025

    invoke-virtual {v3, v6}, Landroid/widget/LinearLayout;->setBackgroundResource(I)V

    goto :goto_0

    .line 102
    :pswitch_2
    const v6, 0x7f020028

    invoke-virtual {v3, v6}, Landroid/widget/LinearLayout;->setBackgroundResource(I)V

    goto :goto_0

    .line 105
    :pswitch_3
    const v6, 0x7f020029

    invoke-virtual {v3, v6}, Landroid/widget/LinearLayout;->setBackgroundResource(I)V

    goto :goto_0

    .line 108
    :pswitch_4
    const v6, 0x7f020027

    invoke-virtual {v3, v6}, Landroid/widget/LinearLayout;->setBackgroundResource(I)V

    goto :goto_0

    .line 94
    nop

    :pswitch_data_0
    .packed-switch 0x1
        :pswitch_0
        :pswitch_1
        :pswitch_2
        :pswitch_3
        :pswitch_4
    .end packed-switch
.end method


# virtual methods
.method public getId()J
    .locals 2

    .prologue
    .line 82
    iget-wide v0, p0, Lcom/xiaomi/notes/DragView;->nId:J

    return-wide v0
.end method

.method public hide()V
    .locals 3

    .prologue
    const/4 v2, 0x0

    .line 68
    iget-object v0, p0, Lcom/xiaomi/notes/DragView;->objWindowsManager:Landroid/view/WindowManager;

    iget-object v1, p0, Lcom/xiaomi/notes/DragView;->viewRoot:Landroid/view/View;

    invoke-interface {v0, v1}, Landroid/view/WindowManager;->removeView(Landroid/view/View;)V

    .line 69
    iput-object v2, p0, Lcom/xiaomi/notes/DragView;->lpWindowManager:Landroid/view/WindowManager$LayoutParams;

    .line 70
    iput-object v2, p0, Lcom/xiaomi/notes/DragView;->objWindowsManager:Landroid/view/WindowManager;

    .line 71
    return-void
.end method

.method public setPosition(II)V
    .locals 3
    .parameter "x"
    .parameter "y"

    .prologue
    .line 74
    iput p1, p0, Lcom/xiaomi/notes/DragView;->nX:I

    .line 75
    iput p2, p0, Lcom/xiaomi/notes/DragView;->nY:I

    .line 76
    iget-object v0, p0, Lcom/xiaomi/notes/DragView;->lpWindowManager:Landroid/view/WindowManager$LayoutParams;

    const/4 v1, 0x0

    iput v1, v0, Landroid/view/WindowManager$LayoutParams;->x:I

    .line 77
    iget-object v0, p0, Lcom/xiaomi/notes/DragView;->lpWindowManager:Landroid/view/WindowManager$LayoutParams;

    iget v1, p0, Lcom/xiaomi/notes/DragView;->nH:I

    sub-int v1, p2, v1

    iput v1, v0, Landroid/view/WindowManager$LayoutParams;->y:I

    .line 78
    iget-object v0, p0, Lcom/xiaomi/notes/DragView;->objWindowsManager:Landroid/view/WindowManager;

    iget-object v1, p0, Lcom/xiaomi/notes/DragView;->viewRoot:Landroid/view/View;

    iget-object v2, p0, Lcom/xiaomi/notes/DragView;->lpWindowManager:Landroid/view/WindowManager$LayoutParams;

    invoke-interface {v0, v1, v2}, Landroid/view/WindowManager;->updateViewLayout(Landroid/view/View;Landroid/view/ViewGroup$LayoutParams;)V

    .line 79
    return-void
.end method

.method public show(Landroid/view/View;Ljava/util/Map;JIIII)V
    .locals 2
    .parameter "view"
    .parameter
    .parameter "id"
    .parameter "x"
    .parameter "y"
    .parameter "w"
    .parameter "h"
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Landroid/view/View;",
            "Ljava/util/Map",
            "<",
            "Ljava/lang/String;",
            "Ljava/lang/Object;",
            ">;JIIII)V"
        }
    .end annotation

    .prologue
    .line 43
    .local p2, map:Ljava/util/Map;,"Ljava/util/Map<Ljava/lang/String;Ljava/lang/Object;>;"
    iput-wide p3, p0, Lcom/xiaomi/notes/DragView;->nId:J

    .line 44
    iput p5, p0, Lcom/xiaomi/notes/DragView;->nX:I

    .line 45
    iput p6, p0, Lcom/xiaomi/notes/DragView;->nY:I

    .line 46
    iput p7, p0, Lcom/xiaomi/notes/DragView;->nW:I

    .line 47
    iput p8, p0, Lcom/xiaomi/notes/DragView;->nH:I

    .line 49
    iput-object p2, p0, Lcom/xiaomi/notes/DragView;->map:Ljava/util/Map;

    .line 51
    new-instance v0, Landroid/view/WindowManager$LayoutParams;

    invoke-direct {v0}, Landroid/view/WindowManager$LayoutParams;-><init>()V

    iput-object v0, p0, Lcom/xiaomi/notes/DragView;->lpWindowManager:Landroid/view/WindowManager$LayoutParams;

    .line 52
    iget-object v0, p0, Lcom/xiaomi/notes/DragView;->lpWindowManager:Landroid/view/WindowManager$LayoutParams;

    const/16 v1, 0x30

    iput v1, v0, Landroid/view/WindowManager$LayoutParams;->gravity:I

    .line 53
    iget-object v0, p0, Lcom/xiaomi/notes/DragView;->lpWindowManager:Landroid/view/WindowManager$LayoutParams;

    iput p5, v0, Landroid/view/WindowManager$LayoutParams;->x:I

    .line 54
    iget-object v0, p0, Lcom/xiaomi/notes/DragView;->lpWindowManager:Landroid/view/WindowManager$LayoutParams;

    iput p6, v0, Landroid/view/WindowManager$LayoutParams;->y:I

    .line 55
    iget-object v0, p0, Lcom/xiaomi/notes/DragView;->lpWindowManager:Landroid/view/WindowManager$LayoutParams;

    iput p8, v0, Landroid/view/WindowManager$LayoutParams;->height:I

    .line 56
    iget-object v0, p0, Lcom/xiaomi/notes/DragView;->lpWindowManager:Landroid/view/WindowManager$LayoutParams;

    iput p7, v0, Landroid/view/WindowManager$LayoutParams;->width:I

    .line 57
    iget-object v0, p0, Lcom/xiaomi/notes/DragView;->lpWindowManager:Landroid/view/WindowManager$LayoutParams;

    const/16 v1, 0x98

    iput v1, v0, Landroid/view/WindowManager$LayoutParams;->flags:I

    .line 60
    iget-object v0, p0, Lcom/xiaomi/notes/DragView;->lpWindowManager:Landroid/view/WindowManager$LayoutParams;

    const v1, 0x3f4ccccd

    iput v1, v0, Landroid/view/WindowManager$LayoutParams;->alpha:F

    .line 61
    iget-object v0, p0, Lcom/xiaomi/notes/DragView;->lpWindowManager:Landroid/view/WindowManager$LayoutParams;

    const/4 v1, -0x2

    iput v1, v0, Landroid/view/WindowManager$LayoutParams;->format:I

    .line 62
    iput-object p1, p0, Lcom/xiaomi/notes/DragView;->viewRoot:Landroid/view/View;

    .line 63
    invoke-direct {p0}, Lcom/xiaomi/notes/DragView;->initView()V

    .line 64
    iget-object v0, p0, Lcom/xiaomi/notes/DragView;->objWindowsManager:Landroid/view/WindowManager;

    iget-object v1, p0, Lcom/xiaomi/notes/DragView;->lpWindowManager:Landroid/view/WindowManager$LayoutParams;

    invoke-interface {v0, p1, v1}, Landroid/view/WindowManager;->addView(Landroid/view/View;Landroid/view/ViewGroup$LayoutParams;)V

    .line 65
    return-void
.end method
